package com.xlh.app;

import com.xlh.api.Dictionary;
import ro.fortsoft.pf4j.Extension;

import java.util.SortedMap;
import java.util.TreeMap;

/**
 * 扩展词典
 *
 * @author xulihua
 * @date 2021/9/24 14:33
 */
@Extension
public class ExtendedDictionary implements Dictionary {
    /**
     * 字典存储的内容
     */
    private final SortedMap<String, String> map = new TreeMap<>();

    /**
     * 构造时即创建字典内容
     */
    public ExtendedDictionary() {
        this.map.put("xml", "a document standard often used in web services, among other things");
        this.map.put("REST", "an architecture style for creating, reading, updating, and deleting data that attempts to use the common vocabulary of the HTTP protocol; Representational State Transfer");
    }

    @Override
    public String getDefinition(String word) {
        return map.get(word);
    }
}
